package com.lbn.jfqsc.app.message.action;

import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.jcodecraeer.xrecyclerview.XRecyclerView;
import com.lbn.baseframe.base.BaseFragment;
import com.lbn.baseframe.base.BaseRecyclerAdapter;
import com.lbn.jfqsc.R;
import com.lbn.jfqsc.app.message.adapter.ActionAdapter;
import com.lbn.jfqsc.app.message.action.detail.DetailActivity;

import butterknife.BindView;
import butterknife.ButterKnife;

public class ActionFragment extends BaseFragment<ActionPresenter> implements IActionView,
        BaseRecyclerAdapter.OnItemClickListener,XRecyclerView.LoadingListener{



    @BindView(R.id.recycler_view)
    XRecyclerView recyclerView;
    private ActionAdapter adapter;
    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        if (rootView == null) {
            rootView = inflater.inflate(R.layout.fragment_action, null, false);
            ButterKnife.bind(this, rootView);
        }
        return rootView;
    }


    @Override
    protected void onPresenterCreated() {
        super.onPresenterCreated();
        adapter = new ActionAdapter(getContext(),null);
        adapter.setOnItemClickListener(this);
        recyclerView.setAdapter(adapter);
        recyclerView.setLoadingListener(this);
    }

    public static ActionFragment newInstance() {
        ActionFragment fragment = new ActionFragment();
        return fragment;
    }

    @Override
    public ActionPresenter createPresenter() {
        return new ActionPresenter();
    }

    @Override
    public void onRefresh() {

    }

    @Override
    public void onLoadMore() {

    }

    @Override
    public void onItemClick(View itemView, int pos) {
//        DetailActivity.startActivity(getContext());
    }
}
